import type { Product } from './product'

export interface CartStock {
  skuId: number
  shoeId: number
  sizeId: number
  colorId: number
  price: number
  discountPrice?: number
  stockQuantity: number
  shoe?: {
    shoeId: number
    name: string
    productImageUrl: string
  }
  size?: {
    sizeId: number
    shoeSize: string
  }
  color?: {
    colorId: number
    colorName: string
    colorCode: string
  }
}

export interface CartItem {
  cartItemId: number
  userId: number
  productId: number
  quantity: number
  price: number
  productName: string
  productImage: string
  sku?: string
  stock: CartStock | number
  selected?: boolean
}

export interface CartAddRequest {
  productId: number
  quantity: number
  sku?: string
}

export interface CartUpdateRequest {
  cartId: number // 与后端参数保持一致
  quantity: number
}

export interface CartRemoveRequest {
  cartItemIds: number[]
}

export interface CartQuery {
  userId?: number
  page?: number
  size?: number
}

// 购物车摘要信息
export interface CartSummary {
  totalItems: number
  totalPrice: number
  selectedItems: number
  selectedPrice: number
}

// 兼容名称（store 中引用了 CartItemAddRequest）
export type CartItemAddRequest = CartAddRequest

// 导出Stock类型
// 由于Stock已在文件开头被导出，此处无需重复导出
